from selenium import webdriver
import time
import DBUtils

class TestBuy:

    #     def test_buy1(self):
    #
    #         driver = webdriver.Chrome()
    #
    #         driver.get(url='http://localhost:90/')
    #
    #         driver.maximize_window()
    #
    #         driver.find_element_by_xpath('//input[@id="username"]').send_keys("lisi")
    #
    #         driver.find_element_by_xpath('//input[@id="password"]').send_keys("123456")
    #
    #         driver.find_element_by_xpath('//button[@id="login_btn"]').click()
    #         # 登录操作
    #
    #         time.sleep(1)
    #
    #         driver.find_element_by_xpath('//nav[@class="sidebar-main"]/ul/li[2]/a').click()
    #         # 点击个人理财
    #         time.sleep(2)
    #         driver.find_element_by_xpath('//nav[@class="sidebar-main"]/ul/li[2]/ul/li[1]').click()
    #
    #         time.sleep(2)
    #
    #         driver.find_element_by_xpath('//div[@class="table-responsive"]/table/tbody/tr[1]/td[last()]/button').click()
    # #         选择投资
    #         time.sleep(2)
    #
    #         driver.find_element_by_xpath('//div[@class="layui-layer-content"]/input[@id="password"]').send_keys("666666")
    #
    #         driver.find_element_by_xpath("//div[@id='layui-layer1']/div[last()]/a[1]").click()
    #         # 点击确定
    #
    #         time.sleep(2)
    #
    #         result = driver.find_element_by_xpath('//div[@class="jconfirm-content"]/div').text
    #
    #         if result == '买入成功!':
    #             print('通过')
    #         else:
    #             print('不通过！')
    #
    #         assert result == '买入成功!'
    #
    #         driver.quit()

    # def test_buy2(self):
    #     driver = webdriver.Chrome()
    #
    #     driver.get(url='http://localhost:90/')
    #
    #     driver.maximize_window()
    #
    #     driver.find_element_by_xpath('//input[@id="username"]').send_keys("lisi")
    #
    #     driver.find_element_by_xpath('//input[@id="password"]').send_keys("123456")
    #
    #     driver.find_element_by_xpath('//button[@id="login_btn"]').click()
    #     # 登录操作
    #
    #     time.sleep(1)
    #
    #     driver.find_element_by_xpath('//nav[@class="sidebar-main"]/ul/li[2]/a').click()
    #     # 点击个人理财
    #     time.sleep(2)
    #     driver.find_element_by_xpath('//nav[@class="sidebar-main"]/ul/li[2]/ul/li[1]').click()
    #
    #     time.sleep(2)
    #
    #     driver.find_element_by_xpath('//div[@class="table-responsive"]/table/tbody/tr[1]/td[last()]/button').click()
    #     #         选择投资
    #     time.sleep(2)
    #
    #     driver.find_element_by_xpath('//div[@class="layui-layer-content"]/input[@id="password"]').send_keys("666667")
    #
    #     driver.find_element_by_xpath("//div[@id='layui-layer1']/div[last()]/a[1]").click()
    #     # 点击确定
    #
    #     time.sleep(2)
    #
    #     result = driver.find_element_by_xpath('//div[@class="jconfirm-content"]/div').text
    #
    #     if result == '买入失败!':
    #         print('通过')
    #     else:
    #         print('不通过！')
    #
    #     assert result == '买入失败!'
    #
    #     driver.quit()


    # def test_buy3(self):
    #     driver = webdriver.Chrome()
    #
    #     driver.get(url='http://localhost:90/')
    #
    #     driver.maximize_window()
    #
    #     driver.find_element_by_xpath('//input[@id="username"]').send_keys("lisi4")
    #
    #     driver.find_element_by_xpath('//input[@id="password"]').send_keys("123456")
    #
    #     driver.find_element_by_xpath('//button[@id="login_btn"]').click()
    #     # 登录操作
    #
    #     time.sleep(1)
    #
    #     driver.find_element_by_xpath('//nav[@class="sidebar-main"]/ul/li[2]/a').click()
    #     # 点击个人理财
    #     time.sleep(2)
    #     driver.find_element_by_xpath('//nav[@class="sidebar-main"]/ul/li[2]/ul/li[1]').click()
    #
    #     time.sleep(2)
    #
    #     driver.find_element_by_xpath('//div[@class="table-responsive"]/table/tbody/tr[1]/td[last()]/button').click()
    #     #         选择投资
    #     time.sleep(2)
    #
    #     driver.find_element_by_xpath('//div[@class="layui-layer-content"]/input[@id="password"]').send_keys("666666")
    #
    #     driver.find_element_by_xpath("//div[@id='layui-layer1']/div[last()]/a[1]").click()
    #     # 点击确定
    #
    #     time.sleep(2)
    #
    #     result = driver.find_element_by_xpath('//div[@class="jconfirm-content"]/div').text
    #
    #     if result == '买入失败!，银行卡余额不足':
    #         print('通过')
    #     else:
    #         print('不通过！')
    #
    #     assert result == '买入失败!，银行卡余额不足'
    #
    #     driver.quit()

    # def test_buy4(self):
    #     driver = webdriver.Chrome()
    #
    #     driver.get(url='http://localhost:90/')
    #
    #     driver.maximize_window()
    #
    #     driver.find_element_by_xpath('//input[@id="username"]').send_keys("lisi5")
    #
    #     driver.find_element_by_xpath('//input[@id="password"]').send_keys("123456")
    #
    #     driver.find_element_by_xpath('//button[@id="login_btn"]').click()
    #     # 登录操作
    #
    #     time.sleep(1)
    #
    #     driver.find_element_by_xpath('//nav[@class="sidebar-main"]/ul/li[2]/a').click()
    #     # 点击个人理财
    #     time.sleep(2)
    #     driver.find_element_by_xpath('//nav[@class="sidebar-main"]/ul/li[2]/ul/li[1]').click()
    #
    #     time.sleep(2)
    #
    #     driver.find_element_by_xpath('//div[@class="table-responsive"]/table/tbody/tr[1]/td[last()]/button').click()
    #     #         选择投资
    #     time.sleep(2)
    #
    #     driver.find_element_by_xpath('//div[@class="layui-layer-content"]/input[@id="password"]').send_keys("666666")
    #
    #     driver.find_element_by_xpath("//div[@id='layui-layer1']/div[last()]/a[1]").click()
    #     # 点击确定
    #
    #     time.sleep(2)
    #
    #     result = driver.find_element_by_xpath('//div[@class="jconfirm-content"]/div').text
    #
    #     if result == '买入失败!，请绑定银行卡':
    #         print('通过')
    #     else:
    #         print('不通过！')
    #
    #     assert result == '买入失败!，请绑定银行卡'
    #
    #     driver.quit()


    # def test_buy5(self):
    #     driver = webdriver.Chrome()
    #
    #     driver.get(url='http://localhost:90/')
    #
    #     driver.maximize_window()
    #
    #     driver.find_element_by_xpath('//input[@id="username"]').send_keys("lisi")
    #
    #     driver.find_element_by_xpath('//input[@id="password"]').send_keys("123456")
    #
    #     driver.find_element_by_xpath('//button[@id="login_btn"]').click()
    #     # 登录操作
    #
    #     time.sleep(1)
    #
    #     driver.find_element_by_xpath('//nav[@class="sidebar-main"]/ul/li[2]/a').click()
    #     # 点击个人理财
    #     time.sleep(2)
    #     driver.find_element_by_xpath('//nav[@class="sidebar-main"]/ul/li[2]/ul/li[2]').click()
    #     # 选择 期限理财
    #     time.sleep(2)
    #
    #     driver.find_element_by_xpath('//div[@class="table-responsive"]/table/tbody/tr[1]/td[last()]/button').click()
    #     # 选择投资
    #     time.sleep(2)
    #
    #     driver.find_element_by_xpath('//div[@class="layui-layer-content"]/input[@id="password"]').send_keys("666666")
    #
    #     driver.find_element_by_xpath("//div[@id='layui-layer1']/div[last()]/a[1]").click()
    #     # 点击确定
    #
    #     time.sleep(2)
    #
    #     result = driver.find_element_by_xpath('//div[@class="jconfirm-content"]/div').text
    #
    #     sql = 'select balance from bankcard where userId = 1 and defaultl = 1'
    #     data = DBUtils.select(sql,[])
    #
    #
    #     if result == '买入成功!' and data[0][0] == 999900.00:
    #         print('通过')
    #     else:
    #         print('不通过！')
    #
    #     assert result == '买入成功!' and data[0][0] == 999900.00
    #
    #     driver.quit()


    # def test_buy6(self):
    #     driver = webdriver.Chrome()
    #
    #     driver.get(url='http://localhost:90/')
    #
    #     driver.maximize_window()
    #
    #     driver.find_element_by_xpath('//input[@id="username"]').send_keys("lisi")
    #
    #     driver.find_element_by_xpath('//input[@id="password"]').send_keys("123456")
    #
    #     driver.find_element_by_xpath('//button[@id="login_btn"]').click()
    #     # 登录操作
    #
    #     time.sleep(1)
    #
    #     driver.find_element_by_xpath('//nav[@class="sidebar-main"]/ul/li[2]/a').click()
    #     # 点击个人理财
    #     time.sleep(2)
    #     driver.find_element_by_xpath('//nav[@class="sidebar-main"]/ul/li[2]/ul/li[2]').click()
    #     # 选择 期限理财
    #     time.sleep(2)
    #
    #     driver.find_element_by_xpath('//div[@class="table-responsive"]/table/tbody/tr[1]/td[last()]/button').click()
    #     # 选择投资
    #     time.sleep(2)
    #
    #     driver.find_element_by_xpath('//div[@class="layui-layer-content"]/input[@id="password"]').send_keys("666667")
    #
    #     driver.find_element_by_xpath("//div[@id='layui-layer1']/div[last()]/a[1]").click()
    #     # 点击确定
    #
    #     time.sleep(2)
    #
    #     result = driver.find_element_by_xpath('//div[@class="jconfirm-content"]/div').text
    #
    #     if result == '买入失败!':
    #         print('通过')
    #     else:
    #         print('不通过！')
    #
    #     assert result == '买入失败!'
    #
    #     driver.quit()

    # def test_buy7(self):
    #     driver = webdriver.Chrome()
    #
    #     driver.get(url='http://localhost:90/')
    #
    #     driver.maximize_window()
    #
    #     driver.find_element_by_xpath('//input[@id="username"]').send_keys("lisi4")
    #
    #     driver.find_element_by_xpath('//input[@id="password"]').send_keys("123456")
    #
    #     driver.find_element_by_xpath('//button[@id="login_btn"]').click()
    #     # 登录操作
    #
    #     time.sleep(1)
    #
    #     driver.find_element_by_xpath('//nav[@class="sidebar-main"]/ul/li[2]/a').click()
    #     # 点击个人理财
    #     time.sleep(2)
    #     driver.find_element_by_xpath('//nav[@class="sidebar-main"]/ul/li[2]/ul/li[2]').click()
    #     # 选择 期限理财
    #     time.sleep(2)
    #
    #     driver.find_element_by_xpath('//div[@class="table-responsive"]/table/tbody/tr[1]/td[last()]/button').click()
    #     # 选择投资
    #     time.sleep(2)
    #
    #     driver.find_element_by_xpath('//div[@class="layui-layer-content"]/input[@id="password"]').send_keys("666666")
    #
    #     driver.find_element_by_xpath("//div[@id='layui-layer1']/div[last()]/a[1]").click()
    #     # 点击确定
    #
    #     time.sleep(2)
    #
    #     result = driver.find_element_by_xpath('//div[@class="jconfirm-content"]/div').text
    #
    #     if result == '买入失败!，银行卡余额不足':
    #         print('通过')
    #     else:
    #         print('不通过！')
    #
    #     assert result == '买入失败!，银行卡余额不足'
    #
    #     driver.quit()


    # def test_buy8(self):
    #     driver = webdriver.Chrome()
    #
    #     driver.get(url='http://localhost:90/')
    #
    #     driver.maximize_window()
    #
    #     driver.find_element_by_xpath('//input[@id="username"]').send_keys("lisi5")
    #
    #     driver.find_element_by_xpath('//input[@id="password"]').send_keys("123456")
    #
    #     driver.find_element_by_xpath('//button[@id="login_btn"]').click()
    #     # 登录操作
    #
    #     time.sleep(1)
    #
    #     driver.find_element_by_xpath('//nav[@class="sidebar-main"]/ul/li[2]/a').click()
    #     # 点击个人理财
    #     time.sleep(2)
    #     driver.find_element_by_xpath('//nav[@class="sidebar-main"]/ul/li[2]/ul/li[2]').click()
    #     # 选择 期限理财
    #     time.sleep(2)
    #
    #     driver.find_element_by_xpath('//div[@class="table-responsive"]/table/tbody/tr[1]/td[last()]/button').click()
    #     # 选择投资
    #     time.sleep(2)
    #
    #     driver.find_element_by_xpath('//div[@class="layui-layer-content"]/input[@id="password"]').send_keys("666666")
    #
    #     driver.find_element_by_xpath("//div[@id='layui-layer1']/div[last()]/a[1]").click()
    #     # 点击确定
    #
    #     time.sleep(2)
    #
    #     result = driver.find_element_by_xpath('//div[@class="jconfirm-content"]/div').text
    #
    #     if result == '买入失败!，请绑定银行卡':
    #         print('通过')
    #     else:
    #         print('不通过！')
    #
    #     assert result == '买入失败!，请绑定银行卡'
    #
    #     driver.quit()


    # def test_buy9(self):
    #     driver = webdriver.Chrome()
    #
    #     driver.get(url='http://localhost:90/')
    #
    #     driver.maximize_window()
    #
    #     driver.find_element_by_xpath('//input[@id="username"]').send_keys("lisi")
    #
    #     driver.find_element_by_xpath('//input[@id="password"]').send_keys("123456")
    #
    #     driver.find_element_by_xpath('//button[@id="login_btn"]').click()
    #     # 登录操作
    #
    #     time.sleep(1)
    #
    #     driver.find_element_by_xpath('//nav[@class="sidebar-main"]/ul/li[2]/a').click()
    #     # 点击个人理财
    #     time.sleep(2)
    #     driver.find_element_by_xpath('//nav[@class="sidebar-main"]/ul/li[2]/ul/li[3]').click()
    #     # 选择 基金理财
    #     time.sleep(2)
    #
    #     driver.find_element_by_xpath('//div[@class="table-responsive"]/table/tbody/tr[1]/td[last()]/button').click()
    #     # 选择投资
    #     time.sleep(2)
    #
    #     driver.find_element_by_xpath('//div[@class="layui-layer-content"]/input[@id="password"]').send_keys("666666")
    #
    #     driver.find_element_by_xpath("//div[@id='layui-layer1']/div[last()]/a[1]").click()
    #     # 点击确定
    #
    #     time.sleep(2)
    #
    #     result = driver.find_element_by_xpath('//div[@class="jconfirm-content"]/div').text
    #
    #     sql = 'select balance from bankcard where userId = 1 and defaultl = 1'
    #     data = DBUtils.select(sql,[])
    #
    #
    #     if result == '买入成功!' and data[0][0] == 999900.00:
    #         print('通过')
    #     else:
    #         print('不通过！')
    #
    #     assert result == '买入成功!' and data[0][0] == 999900.00
    #
    #     driver.quit()


    # def test_buy10(self):
    #     driver = webdriver.Chrome()
    #
    #     driver.get(url='http://localhost:90/')
    #
    #     driver.maximize_window()
    #
    #     driver.find_element_by_xpath('//input[@id="username"]').send_keys("lisi")
    #
    #     driver.find_element_by_xpath('//input[@id="password"]').send_keys("123456")
    #
    #     driver.find_element_by_xpath('//button[@id="login_btn"]').click()
    #     # 登录操作
    #
    #     time.sleep(1)
    #
    #     driver.find_element_by_xpath('//nav[@class="sidebar-main"]/ul/li[2]/a').click()
    #     # 点击个人理财
    #     time.sleep(2)
    #     driver.find_element_by_xpath('//nav[@class="sidebar-main"]/ul/li[2]/ul/li[3]').click()
    #     # 选择 基金理财
    #     time.sleep(2)
    #
    #     driver.find_element_by_xpath('//div[@class="table-responsive"]/table/tbody/tr[1]/td[last()]/button').click()
    #     # 选择投资
    #     time.sleep(2)
    #
    #     driver.find_element_by_xpath('//div[@class="layui-layer-content"]/input[@id="password"]').send_keys("666667")
    #
    #     driver.find_element_by_xpath("//div[@id='layui-layer1']/div[last()]/a[1]").click()
    #     # 点击确定
    #
    #     time.sleep(2)
    #
    #     result = driver.find_element_by_xpath('//div[@class="jconfirm-content"]/div').text
    #
    #
    #     if result == '买入失败!':
    #         print('通过')
    #     else:
    #         print('不通过！')
    #
    #     assert result == '买入失败!'
    #
    #     driver.quit()


    # def test_buy11(self):
    #     driver = webdriver.Chrome()
    #
    #     driver.get(url='http://localhost:90/')
    #
    #     driver.maximize_window()
    #
    #     driver.find_element_by_xpath('//input[@id="username"]').send_keys("lisi4")
    #
    #     driver.find_element_by_xpath('//input[@id="password"]').send_keys("123456")
    #
    #     driver.find_element_by_xpath('//button[@id="login_btn"]').click()
    #     # 登录操作
    #
    #     time.sleep(1)
    #
    #     driver.find_element_by_xpath('//nav[@class="sidebar-main"]/ul/li[2]/a').click()
    #     # 点击个人理财
    #     time.sleep(2)
    #     driver.find_element_by_xpath('//nav[@class="sidebar-main"]/ul/li[2]/ul/li[3]').click()
    #     # 选择 基金理财
    #     time.sleep(2)
    #
    #     driver.find_element_by_xpath('//div[@class="table-responsive"]/table/tbody/tr[1]/td[last()]/button').click()
    #     # 选择投资
    #     time.sleep(2)
    #
    #     driver.find_element_by_xpath('//div[@class="layui-layer-content"]/input[@id="password"]').send_keys("666666")
    #
    #     driver.find_element_by_xpath("//div[@id='layui-layer1']/div[last()]/a[1]").click()
    #     # 点击确定
    #
    #     time.sleep(2)
    #
    #     result = driver.find_element_by_xpath('//div[@class="jconfirm-content"]/div').text
    #
    #
    #     if result == '买入失败!，银行卡余额不足':
    #         print('通过')
    #     else:
    #         print('不通过！')
    #
    #     assert result == '买入失败!，银行卡余额不足'
    #
    #     driver.quit()


    # def test_buy12(self):
    #     driver = webdriver.Chrome()
    #
    #     driver.get(url='http://localhost:90/')
    #
    #     driver.maximize_window()
    #
    #     driver.find_element_by_xpath('//input[@id="username"]').send_keys("lisi5")
    #
    #     driver.find_element_by_xpath('//input[@id="password"]').send_keys("123456")
    #
    #     driver.find_element_by_xpath('//button[@id="login_btn"]').click()
    #     # 登录操作
    #
    #     time.sleep(1)
    #
    #     driver.find_element_by_xpath('//nav[@class="sidebar-main"]/ul/li[2]/a').click()
    #     # 点击个人理财
    #     time.sleep(2)
    #     driver.find_element_by_xpath('//nav[@class="sidebar-main"]/ul/li[2]/ul/li[3]').click()
    #     # 选择 基金理财
    #     time.sleep(2)
    #
    #     driver.find_element_by_xpath('//div[@class="table-responsive"]/table/tbody/tr[1]/td[last()]/button').click()
    #     # 选择投资
    #     time.sleep(2)
    #
    #     driver.find_element_by_xpath('//div[@class="layui-layer-content"]/input[@id="password"]').send_keys("666666")
    #
    #     driver.find_element_by_xpath("//div[@id='layui-layer1']/div[last()]/a[1]").click()
    #     # 点击确定
    #
    #     time.sleep(2)
    #
    #     result = driver.find_element_by_xpath('//div[@class="jconfirm-content"]/div').text
    #
    #
    #     if result == '买入失败!，请绑定银行卡':
    #         print('通过')
    #     else:
    #         print('不通过！')
    #
    #     assert result == '买入失败!，请绑定银行卡'
    #
    #     driver.quit()


    # def test_buy13(self):
    #     driver = webdriver.Chrome()
    #
    #     driver.get(url='http://localhost:90/')
    #
    #     driver.maximize_window()
    #
    #     driver.find_element_by_xpath('//input[@id="username"]').send_keys("lisi6")
    #
    #     driver.find_element_by_xpath('//input[@id="password"]').send_keys("123456")
    #
    #     driver.find_element_by_xpath('//button[@id="login_btn"]').click()
    #     # 登录操作
    #
    #     time.sleep(1)
    #
    #     driver.find_element_by_xpath('//nav[@class="sidebar-main"]/ul/li[2]/a').click()
    #     # 点击个人理财
    #     time.sleep(2)
    #     driver.find_element_by_xpath('//nav[@class="sidebar-main"]/ul/li[2]/ul/li[3]').click()
    #     # 选择 基金理财
    #     time.sleep(2)
    #
    #     driver.find_element_by_xpath('//div[@class="table-responsive"]/table/tbody/tr[1]/td[last()]/button').click()
    #     # 选择投资
    #     time.sleep(2)
    #
    #     driver.find_element_by_xpath('//div[@class="layui-layer-content"]/input[@id="password"]').send_keys("666667")
    #
    #     driver.find_element_by_xpath("//div[@id='layui-layer1']/div[last()]/a[1]").click()
    #     # 点击确定
    #
    #     time.sleep(2)
    #
    #     result = driver.find_element_by_xpath('//div[@class="jconfirm-content"]/div').text
    #
    #
    #     if result == '买入失败!,请前往个人信息设置支付密码':
    #         print('通过')
    #     else:
    #         print('不通过！')
    #
    #     assert result == '买入失败!,请前往个人信息设置支付密码'
    #
    #     driver.quit()


    # def test_buy14(self):
    #     driver = webdriver.Chrome()
    #
    #     driver.get(url='http://localhost:90/')
    #
    #     driver.maximize_window()
    #
    #     driver.find_element_by_xpath('//input[@id="username"]').send_keys("lisi7")
    #
    #     driver.find_element_by_xpath('//input[@id="password"]').send_keys("123456")
    #
    #     driver.find_element_by_xpath('//button[@id="login_btn"]').click()
    #     # 登录操作
    #
    #     time.sleep(1)
    #
    #     driver.find_element_by_xpath('//nav[@class="sidebar-main"]/ul/li[2]/a').click()
    #     # 点击个人理财
    #     time.sleep(2)
    #     driver.find_element_by_xpath('//nav[@class="sidebar-main"]/ul/li[2]/ul/li[3]').click()
    #     # 选择 基金理财
    #     time.sleep(2)
    #
    #     driver.find_element_by_xpath('//div[@class="table-responsive"]/table/tbody/tr[1]/td[last()]/button').click()
    #     # 选择投资
    #     time.sleep(2)
    #
    #     driver.find_element_by_xpath('//div[@class="layui-layer-content"]/input[@id="password"]').send_keys("666666")
    #
    #     driver.find_element_by_xpath("//div[@id='layui-layer1']/div[last()]/a[1]").click()
    #     # 点击确定
    #
    #     time.sleep(2)
    #
    #     result = driver.find_element_by_xpath('//div[@class="jconfirm-content"]/div').text
    #
    #     sql = 'select balance from bankcard where userId = 83 and defaultl = 1'
    #     # lisi7 的id为 83 默认卡余额为 10000
    #     data = DBUtils.select(sql,[])
    #
    #     if result == '买入成功!' and data[0][0] == 7000.00:
    #         print('通过')
    #     else:
    #         print('不通过！')
    #
    #     assert result == '买入成功!' and data[0][0] == 7000.00
    #
    #     driver.quit()


    # def test_buy15(self):
    #     driver = webdriver.Chrome()
    #
    #     driver.get(url='http://localhost:90/')
    #
    #     driver.maximize_window()
    #
    #     driver.find_element_by_xpath('//input[@id="username"]').send_keys("lisi7")
    #
    #     driver.find_element_by_xpath('//input[@id="password"]').send_keys("123456")
    #
    #     driver.find_element_by_xpath('//button[@id="login_btn"]').click()
    #     # 登录操作
    #
    #     time.sleep(1)
    #
    #     driver.find_element_by_xpath('//nav[@class="sidebar-main"]/ul/li[2]/a').click()
    #     # 点击个人理财
    #     time.sleep(2)
    #     driver.find_element_by_xpath('//nav[@class="sidebar-main"]/ul/li[2]/ul/li[3]').click()
    #     # 选择 基金理财
    #     time.sleep(2)
    #
    #     driver.find_element_by_xpath('//div[@class="table-responsive"]/table/tbody/tr[1]/td[last()]/button').click()
    #     # 选择投资
    #     time.sleep(2)
    #
    #     driver.find_element_by_xpath('//div[@class="layui-layer-content"]/input[@id="password"]').send_keys("666666")
    #
    #     driver.find_element_by_xpath("//div[@id='layui-layer1']/div[last()]/a[1]").click()
    #     # 点击确定
    #
    #     time.sleep(2)
    #
    #     result = driver.find_element_by_xpath('//div[@class="jconfirm-content"]/div').text
    #
    #     sql = 'select balance from bankcard where userId = 83 and defaultl = 1'
    #     # lisi7 的id为 83 默认卡余额为 10000
    #     data = DBUtils.select(sql,[])
    #
    #     if result == '买入成功!' and data[0][0] == 7000.00:
    #         print('通过')
    #     else:
    #         print('不通过！')
    #
    #     assert result == '买入成功!' and data[0][0] == 7000.00
    #
    #     driver.quit()


    def test_buy16(self):
        driver = webdriver.Chrome()

        driver.get(url='http://localhost:90/')

        driver.maximize_window()

        driver.find_element_by_xpath('//input[@id="username"]').send_keys("lisi5")

        driver.find_element_by_xpath('//input[@id="password"]').send_keys("123456")

        driver.find_element_by_xpath('//button[@id="login_btn"]').click()
        # 登录操作

        time.sleep(1)

        driver.find_element_by_xpath('//nav[@class="sidebar-main"]/ul/li[2]/a').click()
        # 点击个人理财
        time.sleep(2)
        driver.find_element_by_xpath('//nav[@class="sidebar-main"]/ul/li[2]/ul/li[3]').click()
        # 选择 基金理财
        time.sleep(2)

        driver.find_element_by_xpath('//div[@class="table-responsive"]/table/tbody/tr[1]/td[last()]/button').click()
        # 选择投资
        time.sleep(2)

        driver.find_element_by_xpath('//div[@class="layui-layer-content"]/input[@id="password"]').send_keys("666666")

        driver.find_element_by_xpath("//div[@id='layui-layer1']/div[last()]/a[1]").click()
        # 点击确定

        time.sleep(2)

        result = driver.find_element_by_xpath('//div[@class="jconfirm-content"]/div').text

        if result == '买入失败!，请绑定银行卡':
            print('通过')
        else:
            print('不通过！')

        assert result == '买入失败!，请绑定银行卡'

        driver.quit()